#include <stdio.h>
#include <iostream>
#include <sstream>
using namespace std;

int main(int argc, char *argv[])
{
    stringstream s1("123aaa");
    string s;
    int a;
    s1>>a;
    stringstream s2;
    //s2 << s1.rdbuf();
    s2.str(s1.str());
    s2.seekg(s1.tellg());
    s2.seekp(s1.tellp());
    s1>>s;
    cout<<"s1="<<s<<endl;
    s2>>s;
    cout<<"s2="<<s<<endl;
    return 0;
}
